﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

using ESF.Web;
using ESF.General.Entity;
using ESF.General;
using System.Web.UI.HtmlControls;
using System.Web.UI;
using ESF.SSO.Web.Tools.Modules;
using ESF.SSO.Core.Entities.BasicReferences;
using ESF.SSO.Core.BusinessLogic;

#endregion

// TODO: Pasar las listas a cache
public static class WebGeneral
{
	#region Constantes

	public const string DATETIME_DATEFORMAT = @"dd \d\e MMMM \d\e yyyy";
	public const string DATETIME_DEFAULTFORMAT = "yyyy-MM-dd HH:mm:ss tt";

	#endregion


	#region Listas

	public static List<BasicReference> ListBasicReference (BasicReferenceTypes pBasRefType)
	{
		return ListBasicReference ((int) pBasRefType);
	}

	
	public static List<BasicReference> ListBasicReference (int pBasicReferenceTypeID)
	{
		return CtrlBasicReference.List (pBasicReferenceTypeID);
	}


	public static string[] ListBasicReference (string prefixText, int count, BasicReferenceTypes pBasRefType)
	{
		return ListBasicReference (prefixText, count, (int) pBasRefType);
	}


	private static string[] ListBasicReference (string prefixText, int count, int pBasRefType)
	{
		try
		{
			return DataHelper.ConvertToStringArray (CtrlBasicReference.QueryItemsByName (prefixText, count, pBasRefType));
		}
		catch (Exception pEx)
		{
			Log.Error (pEx);
			return null;
		}
	}

	#endregion
}
